<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .color{
            width: 0%;
            height: 100px;
            background-color: aqua;
            transition: all .5s ;
        }
    </style>
</head>
<body>
    <div class="color"></div>
    <script src="../promise/封装ajax/2.promise封装.js"></script>
    <script>
        async function getData(name){
            for (let i = 0; i < name.length; i++) {
              await ajax(`http://127.0.0.1:8090/publish/${name[i]}.json`)
               let scale=(i+1)/name.length*100
              let div= document.querySelector('.color')
              div.style.width=scale+'%'
              div.innerHTML=parseInt(scale)+'%'
            }
            
        }
        getData(['data','item','data','item','item','item','item','item','item'])
    </script>
</body>
</html>